home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / desktop / winmaze4.zip / SQRMAZE.H < prev   
C/C++ Source or Header  |  1994-05-01  |  3KB  |  101 lines

  1. #ifndef SQRMAZE_H
  2. #define SQRMAZE_H
  3.  
  4. //      Each instance of this class is a maze having square rooms.
  5.  
  6. //      This class uses the classes "cell" (room of a maze) and "oracle"
  7. // (random number generator).
  8.  
  9. class sqrmaze
  10.   {
  11.     private:
  12.       oracle       *column_selector;
  13. //      Random number generator to select column to start constructing maze.
  14.  
  15.       struct
  16.         {
  17.            int row_num;
  18.            int column_num;
  19.         }          current;
  20. //      Current location in maze.
  21.  
  22.       struct
  23.         {
  24.            int row_num;
  25.            int column_num;
  26.         }          first;
  27. //      Location of the starting room.
  28.  
  29.       int          memory_allocated;
  30. //      The two dimensional array of rooms has been allocated.
  31.  
  32.       int          num_columns;
  33. //      Number of columns in maze.
  34.  
  35.       int          num_rows;
  36. //      Number of rows in maze.
  37.  
  38.       oracle       *order_selector;
  39. //      Random number generator to select the order walls are to considered.
  40.  
  41.       cell         **room;
  42. //      Two dimensional array of rooms composing the maze.
  43.  
  44.       oracle       *row_selector;
  45. //      Random number generator to select row to start constructing maze.
  46.  
  47.       int          wall_thickness;
  48. //      Thickness of wall.
  49.  
  50.       TFrameWindow *window_ptr;
  51.     public:
  52.  
  53.       int    constructed(void) {return memory_allocated;}
  54. //      Return TRUE if and only if the maze is successfully constructed.
  55.  
  56.       int    external_to_maze(double x,double y);
  57. //      Return TRUE if and only if a point (x,y) is external to the maze.
  58.  
  59.       double f(double x,double y);
  60. //      Return 6.0*wall_thickness if a point (x,y) is on a wall, 0.0 otherwise.
  61.  
  62.              sqrmaze(int row_count,int column_count,int thickness_of_wall,
  63.               char *seed,TFrameWindow *win_ptr);
  64. //      Contruct a maze having "row_count" rows and "column_count" columns of
  65. // rooms.  The walls should be "thickness_of_wall" (bricks) thick.  A different
  66. // (8 character of less) "seed" generally yields a different maze.
  67.  
  68.              ~sqrmaze(void);
  69.  
  70.       int    maze_okay(void);
  71. //      TRUE if and only if solving the maze is difficult enough.
  72.  
  73.       int    num_x_divisions(void)
  74.               {return 3*wall_thickness*num_rows+wall_thickness+2;}
  75. //      Recommended number of x divisions for plotting f(x,y).
  76.  
  77.       int    num_y_divisions(void)
  78.               {return 3*wall_thickness*num_columns+wall_thickness+2;}
  79. //      Recommended number of y divisions for plotting f(x,y).
  80.  
  81.       int    part_of_solution(double x,double y);
  82. //      Return TRUE if and only if a point (x,y) is on a wall outlining the
  83. // solution to the maze.
  84.  
  85.       double x_max(void)
  86.               {return double(3*wall_thickness*num_rows+wall_thickness);}
  87. //      Recommended maximum value of x for plotting f(x,y).
  88.  
  89.       double x_min(void) {return(-1.0);}
  90. //      Recommended minimum value of x for plotting f(x,y).
  91.  
  92.       double y_max(void)
  93.               {return double(3*wall_thickness*num_columns+wall_thickness);}
  94. //      Recommended maximum value of y for plotting f(x,y).
  95.  
  96.       double y_min(void) {return(-1.0);}
  97. //      Recommended minimum value of y for plotting f(x,y).
  98.   };
  99.  
  100. #endif
  101.